#pragma once

#include "Register.h"

#include <string>
using std::string;
using std::wstring;
#ifdef  _UNICODE
typedef     wstring     xstring;
#else
typedef     string      xstring;
#endif

xstring		ToXString(LPCSTR str);
xstring		ToXString(LPCWSTR str);
wstring     ToWString(LPCTSTR str);
string      ToString(LPCTSTR str);
// CTreeCombo

class CTreeCombo : public CTreeCtrl
{
	DECLARE_DYNAMIC(CTreeCombo)

public:
	CTreeCombo();
	virtual ~CTreeCombo();

protected:
	DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
    bool  LoadXML(const char* fileName);
    DWORD GetValue(DWORD address);
    DWORD SetValue(DWORD address, DWORD value);
    DWORD& operator[](DWORD address);
    //friend DWORD& operator[](CTreeCombo& treeCombo, DWORD address);
    void  Update(void);
protected:
    CComboBox* m_pComboBox;
    CEdit*     m_pEdit;
    CWnd*      m_pCtrl;
    HTREEITEM  m_lastItem;
    CRegList   m_regList;
    map<HTREEITEM,CRegItem*> m_regMap;
};

//DWORD& operator[](CTreeCombo& treeCombo, DWORD address);
